package com.ngkj.zmfptback.sys.service.read.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ngkj.zmfptback.sys.bean.OperationEntity;
import com.ngkj.zmfptback.sys.bean.RoleEntity;
import com.ngkj.zmfptback.sys.bean.UserEntity;
import com.ngkj.zmfptback.sys.mapper.read.UserReadMapper;
import com.ngkj.zmfptback.sys.service.read.UserReadService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ChenHN
 * @since 2021/12/1 creation
 **/
@Service
public class UserReadServiceImpl extends ServiceImpl<UserReadMapper, UserEntity> implements UserReadService {

    @Resource
    private UserReadMapper mapper;

    @Override
    public UserEntity getUserByUserId(String id) {
        return mapper.getUserByUserId(id);
    }

    @Override
    public UserEntity getUserByUsername(String username) {
        return mapper.getUserByUsername(username);
    }

    @Override
    public List<RoleEntity> getRoleByUserId(Integer id) {
        return mapper.getRoleByUserId(id);
    }

    @Override
    public List<OperationEntity> getOperationsByUserId(Integer id) {
        List<OperationEntity> operationsByUserId = mapper.getOperationsByUserId(id);
        return operationsByUserId;
    }

    @Override
    public IPage<UserEntity> getUserList(Page<UserEntity> page1, UserEntity user, String beginTime, String endTime) {
        IPage<UserEntity> userList = mapper.getUserList(beginTime, endTime, user, page1);
        return userList;
    }

    @Override
    public UserEntity getMyUser(String id) {
        return mapper.getMyUser(id);
    }

    @Override
    public Long getRealUserIdByUserId(Long userId) {
        return mapper.getRealUserIdByUserId(userId);
    }

    @Override
    public UserEntity getUserInfoByRealId(Long id) {
        return mapper.getUserInfoByRealId(id);
    }
}
